//
//  MYHomeCellViewModel.swift
//  swift2.0项目开始
//
//  Created by 龚昕炜 on 16/8/1.
//  Copyright © 2016年 龚昕炜. All rights reserved.
//

import UIKit

class MYHomeCellViewModel: NSObject {
    
    var statusModel: MYStatusModel?
    
    /** 返回昵称 */
    var screen_name: String? {
        return statusModel?.user?.screen_name
    }
    
    /** 返回头像的url */
    var photoURL: NSURL? {
        return NSURL(string: statusModel?.user?.profile_image_url ?? "")
    }
    
    /** 返回一个认证的UIImage */
    var verfited_Image: UIImage? {
        switch statusModel?.user?.verified_type ?? -1 {
            case -1: return UIImage()
            case 0: return UIImage(named: "avatar_vip")
            case 2, 3, 5: return UIImage(named: "avatar_enterprise_vip")
            case 220: return UIImage(named: "avatar_grassroot")

            default: return UIImage()
        }
    }
    
    /** 返回会员等级 */
    var level_Image: UIImage? {

        if let num = statusModel?.user?.mbrank {
            return UIImage(named: "common_icon_membership_level\(num)")
        } else {
            return UIImage()
        }
    }
    
    /** 返回评论数量的字符串 */
    var retweet_String: String? {
        
        if let count = statusModel?.reposts_count {
            if count > 0 {
                return "\(count)"
            } else {
                return "转发"
            }
        } else {
            return "转发"
        }
    }

}
